home *** CD-ROM | disk | FTP | other *** search
- Path: airdmhor.gen.nz!not-for-mail
- From: gumboot@airdmhor.gen.nz (Simon Hosie)
- Newsgroups: comp.lang.c
- Subject: Re: What's better & why
- Date: 26 Feb 1996 10:18:09 +1300
- Organization: Airdmhor : a couple of BBS's, a bunch of people, and a cat.
- Message-ID: <4gqjmh$dph@airdmhor.gen.nz>
- References: <31297C5A.E6C@connix.com> <4gf4s6$fl0@kannews.ca.newbridge.com>
- NNTP-Posting-Host: airdmhor.gen.nz
- X-Newsreader: TIN [version 1.2 PL2]
-
- > example 1: val = 1;
- > if( what ever...)val = 0;
- > or
- > example 2: if( what ever... )val = 0;
- > else val = 1;
-
- Glen Miner:
- > If the comiler was dumb, you would get something like the following ASM
- > instructions:
- > ...
- > So, if I wanted speed, like I usually do, and I was willing to pay the
- > extra few bytes in code size, I'd stay with example 2.
-
- I would suggest example 1, on a 486 a "mov reg, most-things" is only 1
- cycle, jumps are 3. On real computers I would suspect that jumping about
- lots (or threatening to jump about lots with conditional jumps) could bother
- their pipelining and technical stuff. Also, real computers have more
- registers and can afford to spend them on things like frequently used
- variables.
-
-
- > Now, I'm no asm genious, and I don't know how smart my compiler is.
- ^ <ahem>
-